﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FsCarInfo.Core.Entity.IRespositories;
using FsCarInfo.Core.Entity.IServices;
using HMIS.FrameWork.DomainBase;
using FsCarInfo.Core.Entity;

namespace FsCarInfo.Facade.Impl
{
    public class CarFacadeImpl : ICarFacade
    {
        private readonly ICarRepository CarRepository;
		//private readonly ICarService CarService;
		public CarFacadeImpl(ICarRepository CarRepository)
        {
			this.CarRepository = CarRepository;
			//this.CarService = CarService;
        }

        #region ICarFacade 成员

		public IList<Car> GetPlist(int start, int limit, string sort, string dir, List<DataFilter> filters, out long total)
        {
            return CarRepository.GetPlistAll(start, limit, sort, dir, filters, out total);
        }

        public bool IsFieldExist(string fieldName, string fieldValue, string id)
        {
            return CarRepository.IsFieldExist(fieldName, fieldValue, id);
        }

		public void SaveOrUpdate(Car entity)
        {
            this.CarRepository.SaveOrUpdate(entity);
        }

        public void Delete(string id)
        {
            CarRepository.Delete(id);
        }

		public IList<Car> QueryPlist(string query, int start, int limit, out long total)
        {
            return CarRepository.QueryPlist(query, start, limit, out total);
        }

		public IList<Car> QueryCarList(string query, int start, int limit, string sort, string dir, List<DataFilter> filters, out long total)
		{
			return CarRepository.QueryCarList(query, start, limit, sort, dir, filters, out total);
		}

		public Car Get(string id)
        {
            return CarRepository.Get(id);
        }

		public Car Load(string id)
        {
            return CarRepository.Load(id);
        }

		public void SaveCar(Car car, string inheritedCarId)
        {
			//CarService.SaveCar(car, inheritedCarId);
        }
        #endregion
    }
}
